/* $Id: atest.c,v 1.2 2006-10-23 17:13:52 nicolasw Exp $ */

#include <string.h>
#include <stdio.h>
#include "atable.h"
#include <assert.h>

#define MUCHO 1000

#define example(x,y) samplea[size] = (void *) x;samples[size] = y;size++;

int main(void)
{
	atable_s *t;
	size_t size=0,j=0;
	void *samplea[MUCHO];
	size_t samples[MUCHO];
	t = atable_create();
	if(t == NULL) return 1;

	example(0x00002311,40);
	example(0x10002311,41);
	example(0x23110000,42);
	example(0x00102311,43);

	for(j=0; j != size;j++)
	{
		assert(atable_insert(t,samplea[j],samples[j]) == 0);
	}

	for(j=0; j != size;j++)
		assert(atable_isdef(t,samplea[j]));

	for(j=size-1; j != 0;j--)
		atable_remove(t,samplea[j]);
	atable_remove(t,samplea[j]);

	atable_destroy(t);
	t = NULL;

	return 0;
}
